<template>
	<view class="vv">

		<view class="view-a"></view>
		<button @click="switchinto" style="width: 330px;height: 40px;" class="wxlogin" v-if="isDisplay">
			登录
		</button>
		<view class="b1" style="width: 330px;height: 120px;">
			<view class="v2">

				  <button class="b2" style="width: 165px; height: 120px;" @click="switchfruit">
					    <image src=" /static/tab_icons/fruit.png" class="i1"  mode="widthFix"></image>
					<text>我的果园</text>
					  </button>
				  <button class="b3" style="width:165px; height:120px" @click="switchfenxi">
					    <image src=" /static/tab_icons/tongji.png" class="i2"  mode="widthFix"></image>
					<text>统计分析</text>
					  </button>
			</view>
		</view>

		<view>
			  <button  style="width: 330px;height: 40px;" class="bu2" @click="switchme">关于我们</button>
			  <button  style="width: 330px;height: 40px;" class="bu4" @click="switchinto"
				v-if="!isDisplay">重新登录</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isDisplay: true

			}
		},
		methods: {
			switchme() {
				uni.navigateTo({
					url: '../../pkg/about/about'
				})
			},
			switchinto() {
				uni.navigateTo({
					url: '../../pkg/login/login'
				})
			},
			switchfruit() {
				//判断如果没有登录，则先去登录
				if (!uni.getStorageSync("token")) {
					uni.navigateTo({
						url: '/pkg/login/login',
					})
				}else{
					uni.navigateTo({
						url: '../../pkg/myfruit/myfruit'
					})
				}
				
			},
			switchfenxi() {
				uni.navigateTo({
					url: '../../pkg/fenxi/fenxi'
				})
			},
			checkDisplay() {
				if (uni.getStorageSync("token")) {
					this.isDisplay = false
				}
			}
		},
		onLoad(options) {
			isDisplay: options.index
		},
		created() {
			this.checkDisplay()
		}
	}
</script>

<style>
	.view-a {
		margin-left: 120px;
		width: 150px;
		height: 130px;
		background-image: url("/static/tab_icons/denglu.png");
		text-align: center;
		background-size: 100% 100%;
	}

	.wxlogin {
		/* padding-top:120px ; */
		/* margin-top: 120px; */
		font-size: 40rpx;
		line-height: 40px;
		width: 200px;
		color: #AD8665;
		background-color: #f5f5f5;

	}

	.view {
		height: 100px;
		width: 375px;
		display: flex;
	}

	.image {
		margin-top: 20px;
		margin-left: 20px;
		margin-right: 0px;
		margin-top: 20px;
		margin-right: 0px;
	}

	.b1 {
		background-color: white;
		margin: 10px 0px 20px 22px;
		padding: 0px 0px 0px 0px;
	}

	.v2 {
		display: flex;
	}


	.b2 {
		border-right: 0px;
		display: flex;
		justify-content: space-between;
		flex-direction: column;

		text-align: center;

		color: #AD8665;
	}

	.b3 {

		text-align: center;

		display: flex;
		justify-content: space-between;
		flex-direction: column;
		color: #AD8665;
	}

	.i1 {
		margin-left: 15px;
		margin-top: 10px;
		width: 100px;
		height: 100px;
	}

	.i2 {
		margin-left: 15px;
		margin-top: 10px;
		width: 100px;
		height: 100px;
	}

	.image {
		width: 60px;
		height: 60px;
		align-items: center;
	}


	.bu2 {
		font-weight: 500;
		color: #AD8665;
	}

	.bu4 {
		font-weight: 500;
		color: #AD8665;
		display: flex;
		justify-content: space-around;
	}
</style>
